#include "IntroFadeState.h"
#include "Portfolio.h"
#include "MainLoopState.h"

IntroFadeState::IntroFadeState()
{
}

IntroFadeState::~IntroFadeState()
{
}

void IntroFadeState::enter()
{
	alphaLevel = 0;
	port->getGUtil()->clearBufferToColor(255, 255, 255);
}

void IntroFadeState::update(const float delta)
{
	const float fadeSpeed = 10.0f;
	alphaLevel = alphaLevel + (fadeSpeed * delta);

	if (static_cast<int>(alphaLevel) > 250)
	{
		port->changeState(new MainLoopState());
		alphaLevel = 250.0f;
	}
}

void IntroFadeState::render()
{
	port->getGUtil()->fader(
		(BITMAP *)port->getRMgr()->GraphicPackA[Mainmenu].dat,
		(BITMAP *)port->getRMgr()->GraphicPackA[Title].dat,
		static_cast<int>(alphaLevel));
	port->getGUtil()->drawBackBufferToScreen();
}